package com.xzh.gulimall.order.controller;

import com.xzh.gulimall.order.entity.OrderEntity;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class RabbitController {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @GetMapping("/send")
    public String sendMq(Integer num)
    {
        rabbitTemplate.convertAndSend("hello-exchange","hello.java",2L);
        OrderEntity orderEntity = new OrderEntity();
        orderEntity.setBillHeader("dsad");
        orderEntity.setBillContent("hah");
        orderEntity.setAutoConfirmDay(2);
        rabbitTemplate.convertAndSend("hello-exchange","hello.java2",orderEntity);
        return "success";

    }
}
